package com.awen.htmlparser.rule;

import org.htmlparser.NodeFilter;

/**
 * 规则设置
 * 用来设置HTML树形结构的规则
 * User: Administrator
 * Date: 13-4-9
 * Time: 上午9:20
 * To change this template use File | Settings | File Templates.
 */
public class RuleConfig {

    private String pathPattern;//结果解析pattern 如：(/html/body.b91/div#bnsLayout/div#888/ul/li) /标签 #id .class 目前来看只能有一层

    private NodeFilter nodeFilter;//由ValuePatternUtil初始化

    private Integer index = 0;//下标，表示符合pathPattern的第几个元素,默认为0 获取列表为-1

    private String valueInvokeMethod = "toHtml"; //默认获取html toHtml获取HTMLText toPlainTextString 获取文本 getLink获取url getLinkText获取<a></a>内的文本text

    private RuleConfig child;

    public String getPathPattern() {
        return pathPattern;
    }

    public void setPathPattern(String pathPattern) {
        this.pathPattern = pathPattern;
    }

    public NodeFilter getNodeFilter() {
        return nodeFilter;
    }

    public void setNodeFilter(NodeFilter nodeFilter) {
        this.nodeFilter = nodeFilter;
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    public RuleConfig getChild() {
        return child;
    }

    public void setChild(RuleConfig child) {
        this.child = child;
    }

    public static enum MatchType{
        NODE("NODEFILTER", 1),
        REGEX("REGESPATTERN", 2);

        private final String name;

        private final Integer index;

        MatchType(String name, Integer index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public Integer getIndex() {
            return index;
        }

    }

    public String getValueInvokeMethod() {
        return valueInvokeMethod;
    }

    public void setValueInvokeMethod(String valueInvokeMethod) {
        this.valueInvokeMethod = valueInvokeMethod;
    }

    public static enum ValueInvokeMethod {



    }

}
